TOPDIR := $(shell pwd)
export TOPDIR
include $(TOPDIR)/TARGET.mk
RELEASE := ./release/
LIBDIR 	:= ./lib

COMPILE_DATE_YMD = $(shell date "+%Y-%m-%d")
COMPILE_DATE_HMS = $(shell date "+%H:%M:%S")

CFLAGS += -Wall -O2 -g -lm -fPIC -pthread 
CFLAGS += -DVERSION_DATE=\"$(COMPILE_DATE_YMD)\"
CFLAGS += -DVERSION_TIME=\"$(COMPILE_DATE_HMS)\"


CFLAGS += -DAPP_NAME=\"$(TARGET_PLATFORM)\"
CFLAGS += -I$(shell pwd)/common

ifeq ($(TARGET_PLATFORM),X64)
LIBS =  -L $(LIBDIR)/X64 
endif #X64


LDFLAGS += -lm -lpthread $(LIBS)
export CFLAGS LDFLAGS

obj-y += testDemo.o
obj-y += common/
obj-y += network/


.PHONY:all clean  clear
all : clean
	make -C ./ -f $(TOPDIR)/Makefile.build
	$(CC) $(CFLAGS)  -o $(TARGET_MODULE_NAME) built-in.o $(LDFLAGS) 
	$(STRIP) $(TARGET_MODULE_NAME)
	mv	$(TARGET_MODULE_NAME) $(RELEASE)
clean:
	rm -f $(shell find -name "*.o")
	rm -f $(shell find -name "*.d")
	rm -f $(RELEASE)/*